# -*- coding: utf-8 -*-
"""
@Time ： 2024/4/18 20:06
@Auth ： 李天天
"""
from Common.handle_log import do_log
from Common.connect_to_device import d_one, d_two

start_share_loc = '(text="开启投屏")'


class BasePage:
    def __init__(self, device):
        # device传字符串
        self.d = device

    def get_element(self, loc):
        try:
            loc = self.d + loc
            ele = eval(loc)
        except:
            do_log.exception("{} 元素表达式格式错误无法转换".format(loc))
            raise
        else:
            return ele


res = BasePage("d_one").get_element(loc=start_share_loc)
res.click()
# 我希望res=d_one(text="开启投屏")
